package com.xqiapp.jsp.config;

import com.xqiapp.jsp.interceptor.JspMvcHandlerInterceptor;
import org.springframework.context.annotation.Bean;
import org.springframework.context.annotation.Configuration;
import org.springframework.web.servlet.config.annotation.InterceptorRegistry;
import org.springframework.web.servlet.config.annotation.WebMvcConfigurerAdapter;
import org.springframework.web.servlet.view.InternalResourceViewResolver;

/**
 * Created by rwrwd7 on 2017/9/25.
 *
 * 配置使用spring mvc系列的配置
 *
 *
 */
@Configuration
public class JspMvcConfig extends WebMvcConfigurerAdapter {

    @Override
    public void addInterceptors(InterceptorRegistry registry) {
        registry.addInterceptor(new JspMvcHandlerInterceptor()).addPathPatterns("/login");

    }


    /*------------------------------------------------------------------------------------------------*/

    /**
     * 可用于替代配置文件中的配置
     *
     * @return
     */
//    @Bean
//    InternalResourceViewResolver internalResourceViewResolver () {
//        InternalResourceViewResolver viewResolver = new InternalResourceViewResolver();
//        viewResolver.setPrefix("/WEB-INF/view/");
//        viewResolver.setSuffix(".jsp");
//        return viewResolver;
//    }

}
